﻿@model ProductsByTagModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";

    //title
    Html.AddTitleParts(string.Format(T("PageTitle.ProductsByTag").Text, Model.TagName));

    //canonical URL
    var canonicalUrlsEnabled = EngineContext.Current.Resolve<SeoSettings>().CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var productsByTagUrl = Url.RouteUrl("ProductsByTag", new { productTagId = Model.Id, SeName = Model.TagName }, this.Request.Url.Scheme);
        Html.AddCanonicalUrlParts(productsByTagUrl);
    }
}
@using Nop.Core.Domain.Seo
@using Nop.Core.Infrastructure
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
<div class="page product-tag-page">
    <div class="page-title">
        <h1>@String.Format(T("Products.Tags.ProductsTaggedWith").Text, Model.TagName)</h1>
    </div>
    <div class="page-body">
        @Html.Widget("productsbytag_top", Model.Id)
        <div class="product-selectors">
        @*view mode*@
        @if (Model.PagingFilteringContext.AllowProductViewModeChanging && Model.Products.Count > 0)
        {
            <div class="product-viewmode">
                <span>@T("Catalog.ViewMode")</span>
                @Html.DropDownList("products-viewmode", Model.PagingFilteringContext.AvailableViewModes, new { onchange = "setLocation(this.value);" })
            </div>
        }
        @*sorting*@
        @if (Model.PagingFilteringContext.AllowProductSorting && Model.Products.Count > 0)
        {
            <div class="product-sorting">
                <span>@T("Catalog.OrderBy")</span>
                @Html.DropDownList("products-orderby", Model.PagingFilteringContext.AvailableSortOptions, new { onchange = "setLocation(this.value);" })
            </div>
        }
        @*page size*@
        @if (Model.PagingFilteringContext.AllowCustomersToSelectPageSize && Model.Products.Count > 0)
        {
            <div class="product-page-size">
                <span>@T("Catalog.PageSize")</span>
                @Html.DropDownList("products-pagesize", Model.PagingFilteringContext.PageSizeOptions, new { onchange = "setLocation(this.value);" })
                <span>@T("Catalog.PageSize.PerPage")</span>
            </div>
        }
        </div>
        @Html.Widget("productsbytag_before_product_list", Model.Id)
        @*product list*@
        @if (Model.Products.Count > 0)
        {
            if (Model.PagingFilteringContext.ViewMode == "list")
            {
            @*list mode*@
            <div class="product-list">
                @foreach (var product in Model.Products)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", product)
                    </div>
                }
            </div>     
            }
            else
            {
            @*grid mode*@
            <div class="product-grid">
                @foreach (var product in Model.Products)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", product)
                    </div>
                }
            </div>
            }
        }
        <div class="pager">
            @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
        </div>
        @Html.Widget("productsbytag_bottom", Model.Id)
    </div>
</div>
